import React from 'react'
// ===================================================================== Temp
import FormModal from '#cpt/temp/FormModal'
// ===================================================================== global declare
const { $fn, $http } = window
// ===================================================================== component
class Index extends React.Component{
	state = {
		data: [],
		// 条码作废
		formData:[
			{ label: '文件夹', name: 'pid', full:true, type:'treeSelect', idStr:'key', nameStr:'title', checkable:false, multiple:false, loading:true, required:true },
		],
	}
	submit = {}
	open = ({title,key})=> {
		this.submit.folder_id = key
		this.getModalSelect()
		this.modal.open({formRef: this.formRef})
	}
	
	// 弹窗获取下拉数据
	getModalSelect = async () => {
		const { formData } = this.state
		$http.pull(null,'doc-file-folder/folderLists').then((data)=>{
			$fn.setRow( formData, 'pid', data )
			this.setState({ formData })
		})
	}
	
	render(){
		return FormModal.call(this, {title:'移动到', labelWidth:'s4', width:600, api:'doc-file-folder/move', onRefresh:()=>window.refreshFolder()} )
	}
}

export default Index